<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>课程播放</title>
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_2384888_ojge9md3tr.css
    ">
    <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="../css/videoPlay.css">
    <link rel="stylesheet" href="../css/index.css">
    <script src="../js/vue-v2.6.10.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
</head>

<body>
    <div id="app">
        <!-- 导航菜单 -->
        <nav>
            <div class="main">
                <img src="../img/public/logo.png" alt="" class="logo">
                <ul>
                    <li><a href="../index.html">首页</a></li>
                    <li class="check"><a href="online.html">全部课程</a></li>
                    <li><a href="javascript:;">在线练习</a></li>
                    <li><a href="javascript:;">精品课程</a></li>
                </ul>
                <div class="search">
                    <div class="left">课程<i class="iconfont icon-down"></i>
                    </div>
                    <input type="text" placeholder="搜索感兴趣的内容">
                    <img src="../img/public/search.png" alt="">
                </div>

                <div class="login" v-if="status">
                    <a href="./loginAndRegister/login.html">登陆</a>
                    /
                    <a href="./loginAndRegister/register.html">注册</a>
                </div>
                <div class="user" v-else="status">
                    <img src="../img/login/user.png" alt="">
                    <div class="userlist">
                        <ul>
                            <li>{{user.name}}</li>
                            <a href="../pages/course.html">
                                <li>课程中心</li>
                            </a>
                            <li>订单中心</li>
                            <li>资金管理</li>
                            <li>个人中心</li>
                            <li class="out">退出登陆</li>
                        </ul>
                    </div>
                </div>
            </div>
        </nav>

        <div class="all">
            <div class="crumbs">
                <span>首页</span>
                <span>></span>
                <span>全部课程</span>
                <span>></span>
                <span>视频详情</span>
            </div>
        </div>
        <!-- 主体内容 -->
        <main>
            <div class="classDetail">
                <div class="left">
                    <video :src="videoUrl" controls></video>
                    <i class="iconfont icon-bofang"></i>
                </div>
                <div class="right">
                    <p class="top">
                        <span class="active">目录</span>
                    </p>
                    <div class="content active">
                        <div class="list" v-for="(value,key) in courseList">
                            <p class="title">{{key}}：公开课（含{{value.length}}期）</p>
                            <ul class="list">
                                <li class="active" v-for="(c,index) in value">
                                    <span>第{{index+1}}节：{{c.name}}</span>
                                    <i class="iconfont icon-bofang" @click="playVideo(c.url)"></i>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row title">
                <span class="active">课程目录</span><span>课程详情</span>
            </div>
            <div class="classlist active">
                <div class="content">
                    <div class="detail" v-for="(value,key) in courseList">
                        <p class="title">{{key}}</p>
                        <ul class="active">
                            <li v-for="c in value">
                                <p>
                                    <i class="iconfont icon-bofang"></i>
                                    <span>{{c.name}}</span>
                                </p>
                                <p>
                                    <span>{{c.start_data}}开播</span>
                                    <span class="start">播放视频</span>
                                </p>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="bottom">
                    <span class="seeAll">抓紧报名学习</span>
                </div>
            </div>
            <div class="classlist" style="display: none;">
                <img src="../img/videoDetail/detail.png" alt="">
            </div>
        </main>

        <footer>
            <div class="cont">
                <div class="main">
                    <p>
                        首页 | 关于我们 | 加入我们 | 合作专区 | 联系我们 | AI开放平台 | 意见反馈 | 漏洞提交 | 隐私政策 | 版权声明 | 反盗链声明 | 网上有害信息举报 | 备案公示 |
                        营业执照
                        | 教师资格证公示
                    </p>
                    <p>
                        京ICP备10218183号-1 京ICP证161188号 七易时代科技有限公司 | 地址：北京市昌平区慧聪采购园 | 电话：010-66666666 | 京公网安备
                        01010102002533号
                    </p>
                    <p>
                        京网文〔2018〕4086-308号 | 网络文化经营许可证：沪网文[2018]4086-308号 | 增值电信业务经营许可证：京B2-20150021 |
                    </p>
                    <p>在线教育许可证：小优课堂经营许可证20188008号 | 互联网教育服务资格证书：(京)-经营性-2018-0011 |</p>
                </div>
            </div>
        </footer>
    </div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            user: {
                uid: ''
            },
            status: '',
            course: '',
            courseList: '',
            videoUrl:''
        },
        methods: {
            initUser() {
                var u = sessionStorage.getItem("user");
                if (u == null || u == '') {
                    this.status = true;
                } else {
                    this.user = JSON.parse(u);
                    this.status = false;
                }
            },
            initCourse() {
                var cid = location.href.split("?")[1];
                axios({
                    method: "post",
                    url: 'http://192.168.194.223:8080/edu/course',
                    params: {
                        flag: 'getCourseInfo',
                        cid: cid
                    }
                }).then(res => {
                    this.course = res.data;
                });
                axios({
                    method: "post",
                    url: 'http://192.168.194.223:8080/edu/courseDetail',
                    params: {
                        flag: 'getCourseInfo',
                        cid: cid
                    }
                }).then(res => {
                    this.courseList = res.data;
                });
            },
            playVideo(url){
                this.videoUrl="http://192.168.194.223:8080/cs_res/course/video/"+url;
            }
        },
        created() {
            this.initUser();
            this.initCourse();
        }

    })
</script>

</html>